<include file="Public/header" /> 

<!--主窗体-->
<div class="container app">
	<!--左侧菜单-->
	<include file="Public/sidebar" /> 
	<!--左侧菜单//-->
	
	<!-- mainCon -->
	<div id="mainCon" class="mainCon">
		<h4>页面列表</h4>
		
		<div>
		<form class="form-inline" method="get">
			<div class="form-group form-group-sm">
				<label for="title">标题：</label>
				<input type="text" class="form-control" id="title" name="title" placeholder="文章标题" value="<{$title}>">
			</div>
			<div class="form-group form-group-sm">
				<label for="">创建时间：</label>
				<input type="text" class="form-control laydate-icon" id="start_time" name="start_time"  value="<{$start_time?($start_time|date='Y-m-d H:i:s',###):''}>" >
				<span>-</span>
				<input type="text" class="form-control laydate-icon" id="end_time" name="end_time"  value="<{$end_time?($end_time|date='Y-m-d H:i:s',###):''}>" >
			</div>

			<div class="form-group form-group-sm">
				<label for="member_disable">状态：</label>
				<select id="status" name="status" class="form-control">
					<option value="all" <if condition="$status eq 'all'">selected</if>>全部</option>
					<option value="1" <if condition="$status === 1">selected</if>>显示</option>
					<option value="0" <if condition="$status === 0">selected</if>>隐藏</option>
				</select>
			</div>
			<div class="bk10"></div>
			<div class="form-group form-group-sm">
				<label for="cate_id">页面栏目(分类)：</label>
				<select id="cate_id" name="cate_id" class="form-control">
					<option>全部</option>
					<foreach name="cate_list" item="row" >
						<option value="<{$row['cat_id']}>" <?php if ($row['cat_id'] == $cate_id) { echo 'selected="selected"'; } ?> ><{$row['cat_name']}></option>
					</foreach>
				</select>
			</div>

			<button type="submit" class="btn btn-default btn-sm  col-md-offset-1"><b>页面筛选</b></button>
		</form>
		</div>
		<div class="bk10"></div>
		<!-- <div>
			<a href="<{:U('Admin/Single/singleAdd',array('k'=>3,'sk'=>11))}>" class="btn btn-default">新建页面</a>
		</div> -->
		<!-- <div class="bk10"></div> -->
		
		<table class="table table-bordered table-hover">
			<tr>
				<th>编号</th>
				<th>标题</th>
				<th>创建时间</th>
				<th>创建人</th>
				<th>所属分类</th>
				<th>状态</th>
				<th>排序</th>
				<th>操作</th>
			</tr>

			<empty name="list">
				<tr><td colspan="8" style="text-align:center;color:#999">～暂无数据～</td></tr>
			<else /> 

				<foreach name="list" item="vo">
					<tr>
						<td><{$vo['id']}></td>
						<td><{$vo['title']}></td>
						<td><{$vo['createtime']|date="Y-m-d H:i",###}></td>
						<td>
							<{$vo['nickname']}>
						</td>
						<td><{$vo['cat_name']}></td>
						<td>
							<if condition="$vo['status'] eq 1">
								<span style="color:#66CC33">显示</span>
							<else />
								<span style="color:#FFA530">隐藏</span>
							</if>
						</td>
						<td><{$vo['taxis']}></td>
						<td>
							<a href="<{:U('Admin/Single/singleEdit',array('id'=>$vo['id'],'k'=>3,'sk'=>11))}>">编辑</a>
							&nbsp;&nbsp;
							<?php /* 移除删除功能，减少误操作
							<a href="javascript:void(0)" class="delAct" data-id="<{$vo['id']}>">删除</a>
							*/ ?>
							<a href="javascript:void(0)" class="statusAct" data-id="<{$vo['id']}>" data-title="<{$vo['title']}>" data-state="<{$vo['status']?0:1}>" >
							<if condition="$vo['status'] eq 1">
								隐藏
							<else />
								显示
							</if>
							</a>
							&nbsp;&nbsp;
							<a href="javascript:void(0)" class="showUrl" data-id="<{$vo['id']}>" data-title="<{$vo['title']}>" data-url="<{:U('Home/Index/manualShow',array('single_id' => $vo['id']),true,true)}>" >
							链接
							</a>
						</td>
					</tr>
				</foreach>
			
			</empty>
			
		</table>
		
		<div class="pagebar">
			<{$pager}>
		</div>
		
	</div>
	<!-- mainCon// -->
	
</div>
<!--主窗体//-->

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
$(function(){
	
	var start = {
		elem: '#start_time',
		format: 'YYYY/MM/DD hh:mm:ss',
		istime: true,
		istoday: false,
		choose: function(datas){
			 end.min = datas;
			 end.start = datas;
		}
	};
	var end = {
		elem: '#end_time',
		format: 'YYYY/MM/DD hh:mm:ss',
		istime: true,
		istoday: false,
		choose: function(datas){
			start.max = datas;
		}
	};
	laydate(start);
	laydate(end);

	<?php /* 移除删除功能，减少误操作
	// $(".delAct").click(function(){
	// 	var that = this;
	// 	layer.confirm('您是否确认删除该记录？删除后不可恢复！', {icon: 3, title:'提示'}, function(index){
	// 		var itemid = $(that).attr("data-id");
	// 		$.post("<{:U('Admin/Single/singleDel')}>",{id:itemid},function(r){
	// 			if(r.error == 1){
	// 				layer.close(index);
	// 				layer.alert(r.errmsg,{icon: 2});
	// 			}else{
	// 				window.location.reload();
	// 			}
	// 		});
	// 	});
	// 	return false;
	// });
	*/ ?>
	
	$(".statusAct").click(function(){
		var that = this;
		var title = $(that).attr('data-title');
		layer.confirm('您是否确认'+$(that).html()+'<'+title+'>', {icon: 3, title:'提示'}, function(index){
			var itemid = $(that).attr("data-id");
			var item_status = $(that).attr("data-state");
			$.post("<{:U('Admin/Single/singleChangeStatus')}>",{id:itemid,status:item_status},function(index){
				if(index.error == 1){
					layer.msg(index.errmsg,{icon:2});
				}else{
					// window.location.reload();
					layer.msg(index.errmsg,{icon:1,time:1000},function(){
						window.location.reload();
					});
				}
			});
		});
		return false;
	});	

	$(".showUrl").click(function(){
		var that = this;
		var title = $(that).attr('data-title');
		layer.alert($(that).attr('data-url'), {title:title});
	});
	
});
</script>

<include file="Public/footer" /> 